#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>
#include <assert.h>

const char* my_strstr(const char* p1, const char* p2)
{
	assert(p1 != NULL);
	assert(p2 != NULL);
	const char* cur1 = p1;
	const char* cur2 = p2;
	while (*p1 != '\0')
	{
		if (*p1 == *p2)
		{
			while (*p2 != '\0')
			{
				p1++;
				p2++;
				if (*p1 == *p2)
					;
				else
					break;
			}
			if (*p2 == '\0')
				return cur1;
			p1 = cur1;
			p2 = cur2;
		}
		p1++;
		cur1++;
	}
	return NULL;
}
int main()
{
	char arr1[] = "abcdefgbbbcsdg";
	char arr2[] = "bbc";
	printf("%s\n", my_strstr(arr1, arr2));
	return 0;
}